cmake_minimum_required(VERSION 2.4.6)

FIND_LIBRARY(LIBVA_LIBRARY NAMES va PATHS ${SEARCH_LIBRARY_PATHS})
if(NOT LIBVA_LIBRARY)
  message(FATAL_ERROR "libva library is missing")
else()
  message(STATUS "libva library found : " ${LIBVA_LIBRARY})
endif()

FIND_LIBRARY(LIBAVFORMAT_LIBRARY NAMES avformat PATHS ${SEARCH_LIBRARY_PATHS})
if(NOT LIBAVFORMAT_LIBRARY)
  message(FATAL_ERROR "libavformat library is missing")
else()
  message(STATUS "libavformat library found : " ${LIBAVFORMAT_LIBRARY})
endif()

FIND_LIBRARY(LIBAVCODEC_LIBRARY NAMES avcodec PATHS ${SEARCH_LIBRARY_PATHS})
if(NOT LIBAVCODEC_LIBRARY)
  message(FATAL_ERROR "libavcodec library is missing")
else()
  message(STATUS "libavcodec library found : " ${LIBAVCODEC_LIBRARY})
endif()

FIND_LIBRARY(LIBAVUTIL_LIBRARY NAMES avutil PATHS ${SEARCH_LIBRARY_PATHS})
if(NOT LIBAVUTIL_LIBRARY)
  message(FATAL_ERROR "libavutil library is missing")
else()
  message(STATUS "libavutil library found : " ${LIBAVUTIL_LIBRARY})
endif()

FIND_LIBRARY(LIBAVDEVICE_LIBRARY NAMES avdevice PATHS ${SEARCH_LIBRARY_PATHS})
if(NOT LIBAVDEVICE_LIBRARY)
  message(FATAL_ERROR "libavdevice library is missing")
else()
  message(STATUS "libavdevice library found : " ${LIBAVDEVICE_LIBRARY})
endif()

FIND_LIBRARY(LIBSWSCALE_LIBRARY NAMES swscale PATHS ${SEARCH_LIBRARY_PATHS})
if(NOT LIBSWSCALE_LIBRARY)
  message(FATAL_ERROR "libswscale library is missing")
else()
  message(STATUS "libswscale library found : " ${LIBSWSCALE_LIBRARY})
endif()

SET(STREAMER_SOURCES 
	../../src/improc.cpp
	../../src/radiometric.cpp
	../../src/ros_resources.cpp
	../../src/tools.cpp
	../../src/video.cpp 
)
INCLUDE_DIRECTORIES(../../include/)

ADD_LIBRARY(thermalvis_streamer_LIBRARIES SHARED ${STREAMER_SOURCES})

rosbuild_add_executable(streamer 
	./src/streamer.cpp
	${STREAMER_SOURCES}
)
INCLUDE_DIRECTORIES(./include/  ../../cfg/cpp/thermalvis/ ../../include/)
target_link_libraries(streamer
	${thermalvis_streamer_LIBRARIES}
	${OpenCV_LIBRARIES}
	${LIBVA_LIBRARY} 
	${LIBAVFORMAT_LIBRARY} 
	${LIBAVCODEC_LIBRARY} 
	${LIBAVUTIL_LIBRARY} 
	${LIBAVDEVICE_LIBRARY} 
	${LIBSWSCALE_LIBRARY}
)

